import dao.FileMeta;
import service.SearchService;

import java.io.File;
import java.util.List;
import java.util.Scanner;

public class ConsoleClient {
    public static void main(String[] args) {
        //先让用户输入一个扫描的文件路径
        //然后再让用户输入一个具体要查询的词
        //根据这个词来进行展开搜索

        Scanner scanner =new Scanner(System.in);
        System.out.println("请输入要扫描的路径：");
        String basePath = scanner.next();

        SearchService searchService = new SearchService();
        searchService.init(basePath);

        while (true){
            System.out.println("请你输入要搜索关键词");
            String word = scanner.next();
            List<FileMeta> fileMetaList = searchService.search(word);
            System.out.println("======================================================================");
            for (FileMeta fileMeta:fileMetaList) {
                System.out.println(fileMeta.getPath()+ File.separator+fileMeta.getName());
            }
            System.out.println("======================================================================");
        }
    }
}
